# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=cloudprint-cups
_gitname=CUPS-Cloud-Print
_commit=1f279036fad249efa8a2bca7f8f54adffd3b59c8
pkgver=20160502.r16.g1f27903
pkgrel=2
epoch=1
pkgdesc='Google Cloud Print driver for CUPS, allows printing to printers hosted on GCP.'
arch=('any')
url='https://github.com/simoncadman/CUPS-Cloud-Print'
license=('GPL3')
depends=('cups' 'imagemagick' 'ghostscript' 'python2-pycups' 'python2' 'python2-httplib2' 'python2-six')
makedepends=('git')
install=$pkgname.install
source=("git+$url#commit=$_commit")
sha512sums=('SKIP')

pkgver() {
  cd $_gitname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $_gitname

  ./configure --prefix /usr

  make
}

package() {
  cd $_gitname

  NOPERMS=1 make DESTDIR="$pkgdir" INSTALL='install -p' install
  python2 -O -m compileall "$pkgdir"/usr/share/$pkgname

  install -dm 755 "$pkgdir"/usr/bin
  ln -sf /usr/share/$pkgname/setupcloudprint.py "$pkgdir"/usr/bin/setupcloudprint
}

